package com.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashSet;

/**
 *
 * @author duyifan
 */
public class Jdbc {
	public ResultSet rs;
	public int count;

	public Jdbc() {
	}

	public Jdbc(String a) throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.jdbc.Driver");

		Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/EnglishDatabase?"
				+ "user=root&password=07051003&useUnicode=true&characterEncoding=UTF8&useSSL=false");
		Statement stmt = con.createStatement();//DbUpEnGliSH!
		count = stmt.executeUpdate(a);
	}

	public void Jdbc_Q2(String a) throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.jdbc.Driver");
		// String url="jdbc:sqlserver://localhost;
		// DatabaseName=AL","sa","123";//假设密码为123

		Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/EnglishDatabase?"
				+ "user=root&password=07051003&useUnicode=true&characterEncoding=UTF8&useSSL=false");

		Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);

		rs = stmt.executeQuery(a);

	}

}
